package com.yami.shop.platform.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yami.shop.bean.model.ShopBankCard;
import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.service.ShopBankCardService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author lth
 * @Date 2021/8/11 15:04
 */
@RestController
@AllArgsConstructor
@RequestMapping("/platform/shopBankCard" )
@Tag(name="银行卡相关接口")
public class ShopBankCardController {

    private final ShopBankCardService shopBankCardService;

    @GetMapping("/listByShopId")
    @Operation(summary =  "根据店铺id批量获取银行卡信息")
    @Parameter(name = "shopId", description = "店铺id")
    public ServerResponseEntity<List<ShopBankCard>> getShopBankCardList(@RequestParam(name="shopId") Long shopId) {
        List<ShopBankCard> list = shopBankCardService.list(new LambdaQueryWrapper<ShopBankCard>().eq(ShopBankCard::getShopId, shopId).eq(ShopBankCard::getStatus,1));
        return ServerResponseEntity.success(list);
    }
}
